package com.shuiyun.canal.entity.enums;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @program: base-canal
 * @description:
 * @author: shuiyun
 * @create: 2020-09-21 12:19
 **/
public enum PoolEnum {


    // 单例
    instance;

    // 批量文件处理专用线程池
    private static ExecutorService pool;

    /**
     * 获取批量拉取oss服务器文件线程池
     *
     * @return
     */
    public ExecutorService queryPool() {
        if (null == pool) {
            synchronized (PoolEnum.class) {
                if (null == pool) {
                    pool= Executors.newFixedThreadPool(100);
                }
            }
        }
        return pool;
    }
}
